<?php if($this->session->flashdata('message_type') != ""): ?>
    <?php if($this->session->flashdata('message_type') == "1"): ?>
        <div class="alert alert-success">
            <i class="fa fa-check-circle"></i> <?php echo $this->session->flashdata('message'); ?>
        </div>
    <?php elseif($this->session->flashdata('message_type') == "0"): ?>
        <div class="alert alert-danger">
            <i class="fa fa-times-circle"></i> <?php echo $this->session->flashdata('message'); ?>
        </div>
    <?php endif; ?> 
<?php endif; ?>

<form id="frm-new-entry" action="<?php echo site_url("Post/update_post_byAdmin/$result[id_post]") ?>" method="POST" enctype="multipart/form-data">
    <?php if(isset($message)): ?>
        <?php  if($message != "0"): ?>
            <div class="alert alert-success" style="width:95%;margin:auto;text-align:center;">
                <i class="fa fa-check-circle"></i> Updating Data Success. Please refresh the page
            </div>
        <?php else : ?>
            <div class="alert alert-danger" style="width:95%;margin:auto;text-align:center;">
                <i class="fa fa-frown-o fa-3x"></i><?php echo $error ?>
            </div>
        <?php  endif; ?>
    <?php endif; ?>

    <div class="col-md-9">
        <label>Entry Title</label>
        <input type="text" name="post_title" class="form-control input-lg frm" value="<?php echo $result['post_title'] ?>"/>

        <label>Entry Content</label>
        <textarea name="post_content" rows="20" class="form-control frm" required="required"><?php echo $result['post_content'] ?></textarea><br/>

        <img src="<?php echo base_url() ?>/Images/Post_Thumb/<?php echo $result['thumbnail'] ?>" width="200px" style="margin: 0px 0px 10px 0px;padding: 5px;background-color: #fff;border: 1px solid #ccc;"/>
        <br/>
        <input type="file" name="thumb"/><br/>
        <input class="btn btn-lg btn-warning" type="submit" name="btn_update_post" value="Update Entry"/>
    </div>
    <div class="col-md-3">
        <label>Category</label>
        <select name="category" class="form-control input-lg frm">
            <option value="" >Select Category</option>
            <?php foreach ($category as $cat) { ?>
            <option value="<?php echo $cat['id_category'] ?>"><?php echo $cat['category_name'] ?></option>
            <?php } ?>
        </select>
        <small style="font-size: 11px; color: #999">Recent Category : <span style="font-size: 13px;font-weight: bold;text-transform: capitalize"><?php echo $result['category_name'] ?></span></small><br/>
        <label>Locations</label>
        <select name="location" class="form-control input-lg frm">
            <option value="">Select Location</option>
            <?php foreach ($location as $loc) { ?>
            <option value="<?php echo $loc['id_location'] ?>"><?php echo $loc['location_name'] ?></option>
            <?php } ?>
        </select>
        <small style="font-size: 11px; color: #999">Recent Location : <span style="font-size: 13px;font-weight: bold;text-transform: capitalize"><?php echo $result['location_name'] ?></span></small>
        <label for="address">
            <div class="input-group">
                <span class="input-group-addon"><i class="fa fa-map-marker"></i></span>
                <input type="text" class="form-control input-sm" name="address" id="address" placeholder="Spesific Location"/>
            </div>
        </label>

        <a href="#" id="GetMaps" class="btn btn-sm btn-primary">Generate Map</a>
        <a href="#" class="btn btn-sm btn-danger" id="Reset">Reset Map</a>
        
        <div class="fisarmonica">
            <div class="input_dinamici">
                <label for="nation">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-flag"></i></span>
                        <input class="form-control input-sm" type="text" name="nation" id="nation"/>
                    </div>
                </label>
                
                <label for="prov">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-globe"></i></span>
                        <input class="form-control input-sm" type="text" name="prov" id="prov"/>
                    </div>
                </label>
                
                <label for="latitude">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-minus-square"></i></span>
                        <input class="form-control input-sm" type="text" name="latitude" id="latitude"/>
                    </div>
                </label>
                
                <label for="longitude">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-plus-square"></i></span>
                        <input class="form-control input-sm" type="text" name="longitude" id="longitude"/>
                    </div>
                </label>
                <br/>

            </div>

            <div id="maps"></div>

            <div class="clear"></div>
        </div>
    </div>
</form>